
/*********************************************************************************************************

Reads in raw precipitation data

Calculates nearest grid point to the latitude and longitude of each Indian district in my dataset

Rainfall data source:
Terrestrial Air Temperature and Precipitation: Monthly and Annual Time Series (1950 - 1999), Version 1.02
Cort J. Willmott and Kenji Matsuura 
Center for Climatic Research, University of Delaware 

Algorithm courtesy of Seema Jayachandran

March 2009

*********************************************************************************************************/

forvalues x = 1950/1999 {
	clear
	infile glon glat jan feb mar apr may jun jul aug sept oct nov dec annual using "$rain\cai_prec.`x'"
	drop if glat<8.5 | glat>33
	drop if glon<69 | glon>89.5
	gen year=`x'
	tempfile rain_`x'
	save `rain_`x''
	}

use `rain_1950', clear
forvalues x = 1951/1999 {
	append using `rain_`x''
	}

sort glat glon year
save "$rain\rain.dta", replace


